<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>风险偏好评估</title>
    {% load static %}
    <link href="{% static 'taa/style.css' %}" rel="stylesheet" type="text/css">
</head>
<body>
<main class="cmp640 ">
    <div id="box1">
        <div class="wrap">
            <h1>家庭智能投顾系统调查问卷</h1>
            <h4>我们将利用专业金融理财框架，为你合理配置家庭资产</h4>
            <h6>您的数据我们会为您保密，请您放心填写</h6>

            <div style="border-bottom:1px dashed #ddd;"></div>

            {% if latest_question_list %}
            {% for question in latest_question_list %}
            <div id="title{{  question.id }}" style="margin-top:20px;">
                <h3>{{ forloop.counter }}.&nbsp;&nbsp;&nbsp;&nbsp;{{ question.question_text }}<span
                        class="req">&nbsp;*</span></h3>
                <ul class="radio">
                    {% for choice in question.choice_set.all %}
                    <li class="one">
                        <input type="radio" id="g1-1" name="radio{{  question.id }}" value="{{ choice.votes }}">
                        <label for="g5-1">{{ choice.choice_text }}</label>
                        {% endfor %}

                </ul>
            </div>
            {% endfor %}
            {% endif %}
        </div><!--end wrap-->

        <div class="txt-c width-5 hang40" style="margin:0 auto;">
            <div class="zi-bai bg-lan" style="border-radius:25px;cursor: pointer" onclick="submit()">
                <span>提交</span>
            </div>
        </div>
        <div class="hang80"></div>
    </div>

</main>


<!-- All JS -->
<script type="text/javascript" src="../../static/taa/jquery-1.11.0.min.js"></script>

<script type="text/javascript">
    function submit() {
        var sum = 0;
        for (i = 1; i <= $(".req").length; i++) {
            var value = $("input[name='radio" + i + "']:checked").val();
            if (typeof value == "undefined") {
                value = 0
            }
            sum += parseInt(value);
        }
        location.href='/taa/'+sum+"/risk"

    }
</script>

</body>
</html>